package lxh.groovy.basic;

def coll = [1, "bbb", "aaa"];
println coll[0]+" "+coll[-1];
println coll.join(",")
println coll.sort();
coll = coll - ["bbb"];
println coll
coll = coll + ["ccc", "ddd"];
coll.each{print it+" "}
println "------------------";


def coll2 = [];
coll2 << "bbb"
coll2.add("aaa")
coll2.add(2);
coll2[2] = 100;
println coll2.get(0)+" size is "+coll2.size();
def coll3 = coll2[1..2];
coll3.each{print it+" "}
println "";

def coll4 = ['aaa','ddd',222,222,'aaa','ccc'];
coll4 = coll4.unique();
println coll4;

def coll5 = [[1,2,3],['a','b','c']];
coll5 = coll5.collect{it[1]};
println coll5;


def coll6 = [4,3,5,5,6,3,2].unique();
println coll6;

def list5 = ['aaa','bbb','ccc'];
list5.set(0, '111');
println list5;

